import util from "@/libs/util";

export default ({ request }) => ({
  /**
   * @description 优惠券列表
   * @param {Number} status
   */
  COUPON_LIST(status = 0) {
    let userinfo = util.store.getItem("userinfo");
    return request({
      url: "/data/v1/couponList",
      method: "post",
      data: {
        id: userinfo.user_id,
        status,
      },
    });
  },
  /**
   * @description 优惠券领取
   * @param {Number} status
   */
  COUPON_RECEIVE(coupon_id) {
    let userinfo = util.store.getItem("userinfo");
    return request({
      url: "/data/v1/couponReceive",
      method: "post",
      data: {
        id: userinfo.user_id,
        coupon_id,
      },
    });
  },
});
